:root {
  --foreground: #454955;
  --background: #fff;
  --background-alt: #f2f1f6;
  --inputs-background: #fefefe;
  --primary: #0071e3; 
  --danger: #ff0800;
  --switch-enabled: #34c759;
  --corner: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --foreground: #fff;
    --background: #222;
    --background-alt: #111;
    --inputs-background: #3f3f3f;
  }
}

html, body {
  height: 100vh;
  padding: 0;
  margin: 5;
  background-color: var(--background-alt);
  color: var(--foreground);
  font: 14px/1.5 '-apple-system', 'HelveticaNeue', Helvetica, Segoe UI;
}

* {
  outline: none !important;
}

h1, h2, h3, h4, h5, h6, b, th, strong {
  color: var(--foreground);
}

input, button, div, pre, p {
  font: inherit;
}

button {
  color: white;
  padding: 0.5em 1em;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  background: var(--primary);
}

.button-container {
  padding-top: 1em;
  text-align: center;
}

button label {
  position: relative;
  cursor: pointer;
  min-width: 10em;
}

button[disabled], button[disabled] label {
  background: #ccc;
  cursor: not-allowed;
}

a, a:link, a:visited {
  color: var(--primary);
  text-decoration: none;
}

input[type=number], input[type=password], input[type=text], select {
  position: relative;
  border: 1px solid #cdcdcd;
  border-color: rgba(0, 0, 0, .15);
  border-radius: var(--corner);
  background-color: var(--inputs-background);
  font-size: 14px;
}

input[type=number], input[type=password], input[type=text] {
  min-width: 158px;
  padding: 3px 10px;
}

input[type=number].short, select.short {
  min-width: 10px;
}

select {
  min-width: 180px;
  max-width: 180px;
  padding: 5px 6px;
}

input[type=range] {
  margin: 0;
}

h1 {
  margin: 0;
  text-align: center;
}

.container {
  padding: 1em;
  margin: 1em auto;
  max-width: 440px;
  background: var(--background);
  border-radius: var(--corner);
}

.form-control {
  margin: 0.4em 0;
}

.form-wrap-control {
  margin: 0.4em 0;
  display: inline-flex;
  flex-wrap: inherit;
}

.form label {
  min-width: 100px;
  max-width: 100px;
  display: inline-block;
}

.helpbadge {
  background-color: var(--background-alt);
  border: 1px solid var(--foreground);
  border-radius: 12px;
  color: var(--foreground) !important;
  font-weight: bold;
  font-size: 14px;
  line-height: 10px;
  height: 13px;
  padding: 6px 6px 1px 6px;
  text-align: center;
  min-width: 8px;
  position: relative;
  float: right;
}

#header_wrapper {
  display: flex;
  justify-content: center;
}

#logo_container {
  width: 320px;
}

#logo {
  display: block;
  margin: 0;
  float: left;
  width: 80px;
  height: 80px;
}

.title {
  color: var(--foreground);
  font-size: 32px;
  font-weight: lighter;
  text-align: left;
  line-height: normal;
  padding: 19px 0 0 0;
}

@media (max-width: 378px) and (min-width: 357px) { 
  .title {
    font-size: 29px;
  }
}

@media (max-width:356px) { 
  .title {
    font-size: 25px;
  }
}

#badges_container {
  display: inline;
}

.badge {
  display: inline;
  background-color: var(--danger);
  border: 2px solid var(--danger);
  border-radius: 12px;
  box-shadow: 1px 1px 1px #282828;
  color: #ffffff;
  font-weight: bold;
  font-size: 12px;
  line-height: 9px;
  height: 12px;
  padding: 0 3px 0 5px;
  text-align: center;
  min-width: 8px;
}

/* make sure that badge text is white
   otherwise it will be blue if it is linked */
a.badge {
  color: #ffffff;
}

.spin {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-bottom: -0.2em;
  border: 0.15em solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  position: absolute;
  top: 0;
  left: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 57px;
  height: 32px;
  min-width: 0.5em !important;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 24px;
  width: 24px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--switch-enabled);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Rounded sliders */
.slider.round {
  border-radius: 32px;
}

.slider.round:before {
  border-radius: 50%;
}

.comma-list {
  display: inline;
  list-style: none;
  padding: 0;
}

.comma-list li {
  display: inline;
}

.comma-list li::after {
  content: ", ";
}

.comma-list li:last-child:after {
  content: "";
}

#color_preview, #color_name, #hue_value, #saturation_value, #brightness_value, #colortemperature_value {
  display: inline-block;
  min-width: 60px;
  text-align: right;
  min-height: 15px;
}

#color_preview {
  width: 140px;
}

#hap_setup_info {
  text-align: center;
}

#qrcode_container {
  color: var(--foreground);
  width: 240px;
  height: 240px;
  margin-top: 15px;
  margin-left: auto;
  margin-right: auto;
}

.qrcode_text {
  fill: var(--foreground);
  font-family: Arial, sans-serif; 
  font-size: 54px;
  font-weight: bold;
  text-anchor: end;
}

.tab_wrapper {
  display: flex;
  flex-direction: column;
  align-items: left;
}

.tab {
  cursor: pointer;
  padding: 10px 20px;
  display: inline-block;
  border-width: 1px;
  border-radius: var(--corner) var(--corner) 0 0;
  border-color: var(--primary);
}

.panels {
  padding-left: 1em;
  padding-right: 1em;
  border-radius: 0 var(--corner) var(--corner) var(--corner);
  border-left: 1px solid var(--primary);
  border-right: 1px solid var(--primary);
  border-bottom: 1px solid var(--primary);
  border-top: 1px solid var(--primary);
}

.panel {
  display: none;
  animation: fadein .5s;
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

.tab_radio {
  display: none;
}

#one:checked ~ .panels #panel1,
#two:checked ~ .panels #panel2,
#three:checked ~ .panels #panel3 {
  display: block;
}

#two:checked ~ .panels,
#three:checked ~ .panels {
  border-top-left-radius: 10px;
}

#one:checked ~ .tabs #tab1,
#two:checked ~ .tabs #tab2,
#three:checked ~ .tabs #tab3 {
  border-top: 3px solid var(--primary);
  border-left: 1px solid var(--primary);
  border-right: 1px solid var(--primary);
  border-bottom: 1px solid var(--primary);
  background: var(--primary);
  color: white;
}
